using System;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
namespace Microsoft.Phone.Controls
{
	internal static class Extensions
	{
		private const string ExternalAddress = "app://external/";
		public static bool Invert(this Matrix m, out Matrix outputMatrix)
		{
			double num = m.get_M11() * m.get_M22() - m.get_M12() * m.get_M21();
			if (num == 0.0)
			{
				outputMatrix = m;
				return false;
			}
			Matrix matrix = m;
			m.set_M11(matrix.get_M22() / num);
			m.set_M12(-1.0 * matrix.get_M12() / num);
			m.set_M21(-1.0 * matrix.get_M21() / num);
			m.set_M22(matrix.get_M11() / num);
			m.set_OffsetX((matrix.get_OffsetY() * matrix.get_M21() - matrix.get_OffsetX() * matrix.get_M22()) / num);
			m.set_OffsetY((matrix.get_OffsetX() * matrix.get_M12() - matrix.get_OffsetY() * matrix.get_M11()) / num);
			outputMatrix = m;
			return true;
		}
		public static bool Contains(this string s, string value, StringComparison comparison)
		{
			return s.IndexOf(value, comparison) >= 0;
		}
		public static bool IsPortrait(this PageOrientation orientation)
		{
			return 1 == (1 & orientation);
		}
		public static bool IsDarkThemeActive(this ResourceDictionary resources)
		{
			return (Visibility)resources.get_Item("PhoneDarkThemeVisibility") == 0;
		}
		public static bool IsExternalNavigation(this Uri uri)
		{
			return "app://external/" == uri.ToString();
		}
		public static void RegisterNotification(this FrameworkElement element, string propertyName, PropertyChangedCallback callback)
		{
			DependencyProperty dependencyProperty = DependencyProperty.RegisterAttached("Notification" + propertyName, typeof(object), typeof(FrameworkElement), new PropertyMetadata(callback));
			DependencyProperty arg_3C_1 = dependencyProperty;
			Binding binding = new Binding(propertyName);
			binding.set_Source(element);
			element.SetBinding(arg_3C_1, binding);
		}
	}
}
